var common = require('../../../utils/common.js');
var app = getApp();
Page({
  data: {
    currentTab: 0,
    height: 230
  },
  onReady: function() {
    // 页面首次渲染完毕时执行
   
    this.jisuanHeight();
  },
  onLoad: function (options) {
    // 页面初始化 options为页面跳转所带来的参数
    



    var that=this;
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          clientHeight: res.windowHeight
        });
      }
    });

  },
  //滑动切换
  swiperTab: function (e) {
    var that = this;
    that.setData({
      currentTab: e.detail.current
    });
    this.jisuanHeight();
  },
  jisuanHeight: function(e){
    var query = wx.createSelectorQuery();
    //选择id
    var that = this;
    var cla = '';
    if (that.data.currentTab === 0)
      cla = '.evaluates';
    else if (that.data.currentTab === 1)
      cla = '.plan_details';

    query.select(cla).boundingClientRect(function (rect) {
      console.log()
      rect.height += 20;
      that.setData({
        height: rect.height
      })
    }).exec();
  },
  //点击切换
  clickTab: function (e) {
    var that = this;
    if (this.data.currentTab === e.target.dataset.current) {
      return false;
    } else {
      that.setData({
        currentTab: e.target.dataset.current
      })
    }
  },
  swiperchange: function (e) {
    var that = this
    console.log(e.detail.current)
    that.setData({
      'currentTab': e.detail.current
    })
    }
  
})